<template>
    <van-nav-bar :title="info.name" />
    <div class="layout">
        <van-form @submit="deal(2)" @return="deal(3)">
            <div class="title">
                <h3>单据信息</h3>
            </div>
            <van-cell-group inset>
                <van-field readonly v-model="data.postDate" name="事务处理日期" label="事务处理日期" />
                <van-field readonly v-model="data.shipDate1" name="收货日期" label="收货日期" />
                <van-field readonly v-model="data.handlerUserId" name="经办人" label="经办人" />
                <van-field readonly v-model="data.deliveryAdviceNo" name="发货单号" label="发货单号" />
            </van-cell-group>
            <div class="title">
                <h3>收货明细</h3>
            </div>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<router-link :to="{name:'/quality',params:'质检单号'}">查看</router-link>
            <van-collapse v-model="activeNames">
                <van-collapse-item v-for="(item, index) in data.list" :key="index" :title="item.materialName"
                    :name="index + 1">
                    <!-- 无子级 -->
                    <div v-if="!item.batchInfoList">
                        <van-cell-group inset>
                            <div style="display:flex">
                                <van-field v-model="item.processRowCode" name="行号" label="行号" />
                                <van-field v-model="item.warehousingQuantity" name="入库数量" label="入库数量" />
                            </div>
                        </van-cell-group>
                    </div>
                    <!-- 有子级 -->
                    <div v-if="item.batchInfoList">
                        <van-cell-group inset>
                            <van-field v-model="item.processRowCode" name="行号" label="行号" />
                            <van-field v-model="item.waterRatio" name="水分" label="水分" />
                            <van-field v-model="item.qualityType" name="摸底质检" label="摸底质检" />
                            <van-field v-model="item.warehousingQuantity" name="入库数量" label="入库数量" />
                            <van-field v-model="item.orderNo" name="进厂质检" label="进厂质检" />
                        </van-cell-group>
                    </div>

                </van-collapse-item>
            </van-collapse>
            <div style="margin: 0.667rem;display:flex">
                <van-button round block  type="primary" native-type="submit" style="width:4.167rem">
                    同意
                </van-button>
                <van-button round block type="primary" native-type="return" style="width:4.167rem">
                    驳回
                </van-button>
            </div>
        </van-form>
    </div>

</template>
<script lang="ts">
import { defineComponent, ref, reactive } from 'vue';
import { get, post, getQueryVariable } from "@/request/useRequest";
import options from "@/views/workflowConfig/yuanfucaishouhuoConfig";
import { workflow } from "@/utils/hooks/workflow";
export default defineComponent({
    name: 'yuanfucaishouhuo',
    setup() {
        let data: any = ref({})
        let info: any = ref({})
        let id = getQueryVariable("id")
        let formInfoId = getQueryVariable("formInfoId")
        get('formInstance/getFormData', { id, formInfoId }).then((res: any) => {
            if (res.status == 200) {
                info.value = res.data.formInfo
                data.value = res.data.formData.variable.variables
                console.log("🚀 ~ file: index.vue:69 ~ get ~ data", data)
            }
        })
        const activeNames = ref([1]);
        const {
            keyConfig,
            state,
            start,
            save,
            deal,
            fallback,
            diagram,
            execute,
            refreshDeal,
            assignKey,
            formKey,
            spinning,
            delayTime,
            title,
        } = workflow(data, options, true);

        return {
            data,
            activeNames,
            deal,
            info
        }
    }
});
</script>
<style lang="less">
.title {
    background-color: aqua;
    text-align: center
}
</style>